//
//  DYMacroTools.h
//  dyss_v2
//
//  Created by LXF on 16/1/27.
//  Copyright © 2016年 First Facility. All rights reserved.
//


#define bindEvent_onClick(v)  [self.v addTarget:self \
action:@selector(v ##_onClick) forControlEvents:UIControlEventTouchUpInside];

#define bindEvent_onClickWithSel(v,sel)  [self.v addTarget:self \
action:@selector(sel) forControlEvents:UIControlEventTouchUpInside];


#define invokeBlock_safe(block,...) {\
    if (block) {\
        block(__VA_ARGS__);\
    }else{\
        printE(@"block 为 nil")\
    }\
}

#define execBlock_safe(block,...) invokeBlock_safe(block,##__VA_ARGS__)

#define button_onClick_Method(btn)  (void)btn ##_onClick

#define NSStringWithFormat(formatStr,...) [NSString stringWithFormat:formatStr,##__VA_ARGS__]

#define NSStringWithFormatByLocalString(formatStr,...) [NSString stringWithFormat: LocalString(formatStr),##__VA_ARGS__]

#define NSArrayAdd(array,obj) array = [array arrayByAddingObject:obj]

#define NSArrayDel(array,obj) {\
    NSMutableArray *___arrayM = array.mutableCopy;\
    [___arrayM removeObject:obj];\
    array = ___arrayM.copy;\
}

#define LocalString(key) NSLocalizedString(key, @"")


#define iOS_SystemVersion [[UIDevice currentDevice].systemVersion doubleValue]


#define i2s(i) [NSString stringWithFormat:@"%zd",(i)]
#define f2s(f) [NSString stringWithFormat:@"%f",(f)]

